package com.zye.service;

import com.zye.dao.UserDao;
import com.zye.dao.UserDaoImpl;
import com.zye.entity.User;
import com.zye.service.UserService;

/**
 * 用户业务逻辑实现类
 */
public class UserServiceImpl implements UserService {

    //调用DAO对象
    private UserDao userDao= new UserDaoImpl();

    @Override
    public User login(String username, String password) {
        // 调用DAO对象，通过用户名查询用户
        User user = userDao.selectUserByUsername(username);
        // 判断用户是否存在，并且密码是否正确
        if(user != null){
            if(password.equals(user.getPassword())){
                return user;
            }
        }
        return null;
    }
}


